home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / crwdemo / sorting.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  8.1 KB  |  283 lines

  1. VERSION 2.00
  2. Begin Form Sort 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Record Sort Fields"
  5.    ClientHeight    =   4320
  6.    ClientLeft      =   1500
  7.    ClientTop       =   4110
  8.    ClientWidth     =   7230
  9.    Height          =   5010
  10.    Left            =   1440
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4320
  13.    ScaleWidth      =   7230
  14.    Top             =   3480
  15.    Width           =   7350
  16.    Begin CommandButton Command8 
  17.       Caption         =   "Help"
  18.       Height          =   375
  19.       Left            =   3000
  20.       TabIndex        =   3
  21.       Top             =   3240
  22.       Width           =   1095
  23.    End
  24.    Begin TextBox Text4 
  25.       Height          =   375
  26.       Left            =   1920
  27.       TabIndex        =   14
  28.       Top             =   1800
  29.       Width           =   2055
  30.    End
  31.    Begin CommandButton Command7 
  32.       Caption         =   "Set Sort Field"
  33.       Height          =   375
  34.       Left            =   240
  35.       TabIndex        =   18
  36.       Top             =   1800
  37.       Width           =   1335
  38.    End
  39.    Begin TextBox Text3 
  40.       Height          =   375
  41.       Left            =   1920
  42.       TabIndex        =   17
  43.       Top             =   1320
  44.       Width           =   2055
  45.    End
  46.    Begin CommandButton Command6 
  47.       Caption         =   "Get Sort Field"
  48.       Height          =   375
  49.       Left            =   240
  50.       TabIndex        =   16
  51.       Top             =   1320
  52.       Width           =   1335
  53.    End
  54.    Begin CommandButton Command5 
  55.       Caption         =   "# Sort Fields"
  56.       Height          =   375
  57.       Left            =   240
  58.       TabIndex        =   15
  59.       Top             =   855
  60.       Width           =   1335
  61.    End
  62.    Begin TextBox Text2 
  63.       Enabled         =   0   'False
  64.       Height          =   375
  65.       Left            =   1920
  66.       TabIndex        =   13
  67.       Top             =   840
  68.       Width           =   2055
  69.    End
  70.    Begin TextBox Text1 
  71.       Height          =   375
  72.       Left            =   5520
  73.       TabIndex        =   11
  74.       Top             =   840
  75.       Width           =   855
  76.    End
  77.    Begin CommandButton Command4 
  78.       Caption         =   ">>"
  79.       Height          =   375
  80.       Left            =   6000
  81.       TabIndex        =   10
  82.       Top             =   1440
  83.       Width           =   855
  84.    End
  85.    Begin CommandButton Command3 
  86.       Caption         =   "<<"
  87.       Height          =   375
  88.       Left            =   5040
  89.       TabIndex        =   9
  90.       Top             =   1440
  91.       Width           =   855
  92.    End
  93.    Begin SSOption Option3D1 
  94.       Caption         =   "Descending"
  95.       Height          =   495
  96.       Index           =   1
  97.       Left            =   5160
  98.       TabIndex        =   6
  99.       TabStop         =   0   'False
  100.       Top             =   2880
  101.       Width           =   1335
  102.    End
  103.    Begin SSOption Option3D1 
  104.       Caption         =   "Ascending"
  105.       Height          =   495
  106.       Index           =   0
  107.       Left            =   5160
  108.       TabIndex        =   5
  109.       Top             =   2400
  110.       Value           =   -1  'True
  111.       Width           =   1215
  112.    End
  113.    Begin SSPanel Panel3D1 
  114.       Alignment       =   1  'Left Justify - MIDDLE
  115.       BevelInner      =   1  'Inset
  116.       BorderWidth     =   1
  117.       Height          =   1335
  118.       Left            =   5040
  119.       TabIndex        =   4
  120.       Top             =   2280
  121.       Width           =   1815
  122.    End
  123.    Begin CommandButton Command2 
  124.       Caption         =   "Cancel"
  125.       Height          =   375
  126.       Left            =   1680
  127.       TabIndex        =   2
  128.       Top             =   3240
  129.       Width           =   1095
  130.    End
  131.    Begin CommandButton Command1 
  132.       Caption         =   "OK"
  133.       Height          =   375
  134.       Left            =   240
  135.       TabIndex        =   1
  136.       Top             =   3240
  137.       Width           =   1215
  138.    End
  139.    Begin SSPanel StatusBar 
  140.       Alignment       =   1  'Left Justify - MIDDLE
  141.       BorderWidth     =   1
  142.       Height          =   495
  143.       Left            =   0
  144.       TabIndex        =   0
  145.       Top             =   3840
  146.       Width           =   7335
  147.    End
  148.    Begin Label Label3 
  149.       Alignment       =   2  'Center
  150.       BackColor       =   &H00C0C0C0&
  151.       Caption         =   "Sort Field Number"
  152.       Height          =   255
  153.       Left            =   4920
  154.       TabIndex        =   12
  155.       Top             =   480
  156.       Width           =   1935
  157.    End
  158.    Begin Label Label2 
  159.       BackColor       =   &H00C0C0C0&
  160.       Caption         =   "# Sort Fields"
  161.       Height          =   255
  162.       Left            =   1920
  163.       TabIndex        =   8
  164.       Top             =   480
  165.       Width           =   1215
  166.    End
  167.    Begin Label Label1 
  168.       BackColor       =   &H00C0C0C0&
  169.       Caption         =   "Sort Direction"
  170.       Height          =   255
  171.       Left            =   5040
  172.       TabIndex        =   7
  173.       Top             =   2040
  174.       Width           =   1215
  175.    End
  176.    Begin Menu MenuFile 
  177.       Caption         =   "&File"
  178.       Begin Menu MenuFileExit 
  179.          Caption         =   "&Exit"
  180.       End
  181.    End
  182. Dim NumFields As Integer
  183. Sub Command1_Click ()
  184.  Unload Me
  185. End Sub
  186. Sub Command2_Click ()
  187.  Unload Me
  188. End Sub
  189. Sub Command3_Click ()
  190.    Dim nSort As Integer
  191.    If (SortN > 0) Then
  192.       SortN = SortN - 1
  193.       Text1.Text = SortN
  194.    End If
  195. End Sub
  196. Sub Command4_Click ()
  197.    Dim nSorts As Integer
  198.    nSorts = PEGetNSortFields(JobNum)
  199.   If nSorts = 0 Then
  200.      Text1.Text = 0
  201.    Else
  202.      If (SortN < nSorts - 1) Then
  203.     SortN = SortN + 1
  204.     Text1.Text = SortN
  205.      End If
  206.    End If
  207. End Sub
  208. Sub Command5_Click ()
  209.  NumFields = PEGetNSortFields(JobNum)
  210.  If NumFields >= 0 Then
  211.    Sort!StatusBar.Caption = "# of Sort fields Retrieved"
  212.    Text1.Text = 0
  213.    Text2.Text = NumFields
  214.    Else
  215.       RCode = GetErrorString(JobNum)
  216.       MsgBox "PEGetNSortFields Error #: " + Str(ErrorCode) + " - " + RCode
  217.  End If
  218. End Sub
  219. Sub Command6_Click ()
  220.   Dim TextHandle As Integer, TextLength As Integer
  221.   Dim FieldName As String
  222.   If NumFields = 0 Then
  223.    MsgBox ("There are no sort fields to retrieve.")
  224.   Else
  225.    If PEGetNthSortField(JobNum, Text1.Text, TextHandle, TextLength, d%) = False Then
  226.       RCode = GetErrorString(JobNum)
  227.       MsgBox "PEGetNthSortField Error #: " + Str(ErrorCode) + " - " + RCode
  228.     End If
  229.     ' Allocate memory for FieldName
  230.     FieldName = String$(TextLength, " ")
  231.     If PEGetHandleString(TextHandle, FieldName, TextLength) = False Then
  232.       RCode = GetErrorString(JobNum)
  233.       MsgBox "PEGetHandleString Error #: " + Str(ErrorCode) + " - " + RCode
  234.     Else
  235.       Sort!StatusBar.Caption = "Sort field number " + Text1.Text + " has been retrieved"
  236.       Text3.Text = FieldName
  237.     End If
  238.     If d% = 0 Then
  239.       Option3d1(1).Value = True
  240.       Option3d1(0).Value = False
  241.     Else
  242.       Option3d1(0).Value = True
  243.       Option3d1(1).Value = False
  244.     End If
  245.   End If
  246. End Sub
  247. Sub Command7_Click ()
  248.   If Text4.Text = "" Then
  249.     MsgBox "You must enter a field name to set the sort direction!"
  250.   Else
  251.     ' Now Set the sort field with new direction
  252.     If Option3d1(0) = True Then
  253.       d% = 1
  254.     Else
  255.       d% = 0
  256.     End If
  257.     If PESetNthSortField(JobNum, Text1.Text, Text4.Text, d%) = False Then
  258.       RCode = GetErrorString(JobNum)
  259.       MsgBox "PESetNthSortField Error #: " + Str(ErrorCode) + " - " + RCode
  260.     Else
  261.       Sort!StatusBar.Caption = "Sort field number " + Text1.Text + " has been set."
  262.     End If
  263.   End If
  264. End Sub
  265. Sub Command8_Click ()
  266.  RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  267.  If RCode = False Then
  268.    MsgBox ("RedPoint cannot find the Crystal Help file in C:\CRW directory")
  269.  End If
  270. End Sub
  271. Sub MenuFileExit_Click ()
  272.  Unload Me
  273. End Sub
  274. Sub Option3D1_Click (Index As Integer, Value As Integer)
  275.  'If Option3d1(0).Value Then
  276.  '  Option3d1(1).Value = False
  277.  '  Option3d1(0).Value = True
  278. ' Else
  279.  '  Option3d1(0).Value = True
  280.   ' Option3d1(1).Value = False
  281. ' End If
  282. End Sub
  283.